﻿Imports Crom.Controls.Docking
Imports DevComponents.DotNetBar
Imports dto
Imports bus
Imports truc
Imports viet
Public Class MANHINH_CHINH

#Region "Biến"
    'Dim bus As New may
    Dim BusQuyenchitiet As New QuyenchitietBus(ketnoi)
#End Region

#Region "Hàm"
    Private Sub DICHTIENGANH()
        If LSchinh.ENGLISH Then
            Dim DATAT As DataTable = BusQuyenchitiet.LayBangTableTheoQuyen(0, Me.Name)
            For I As Integer = 0 To DATAT.Rows.Count - 1
                XEM_Ngonngu(Me, DATAT.Rows(I)("TenButon"), DATAT.Rows(I)("Ghichu"))
            Next
        End If
    End Sub
    Private Sub kiemtrabut(ByVal str As String)
        For i As Int16 = 0 To RibbonControl1.Items.Count - 1
            Dim cntr As RibbonTabItem = RibbonControl1.Items(i)
            If cntr.Name = str Then
                cntr.Visible = False
                Exit Sub
            End If
            For j As Int16 = 0 To cntr.Panel.Controls.Count - 1
                Dim panel As RibbonBar = cntr.Panel.Controls(j)
                If panel.Name = str Then
                    panel.Visible = False
                    Exit Sub
                End If
                For k As Int16 = 0 To panel.Items.Count - 1
                    Dim con As ButtonItem = panel.Items(k)
                    If con.Name = str Then
                        con.Visible = False
                        Exit Sub
                    End If
                Next
            Next
        Next
    End Sub
#End Region

#Region "Sự kiện"
#Region "Man hình chính"
    Private Sub MANHINH_CHINH_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        Try
            CloseFormALL_khac(DockContainer1, "Hoadontheothang")
        Catch ex As Exception
        End Try
    End Sub
    Private Sub MANHINH_CHINH_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    End Sub
    Private Sub MANHINH_CHINH_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
        Try
            ManHinhDangNhap.ShowDialog()
            If ManHinhDangNhap.StatusLogin = ManHinhDangNhap.Login.iFail Then
                Me.Close()
            Else
                'Me.Text = "GBU SOFTWARE - " & LSchinh.tencongty & " - " & LSchinh.diachiCT
                Me.Text = LSchinh.tencongty & " - " & LSchinh.diachiCT
                Dim i As Integer = 10000000
                Dim ngay As Date = DateSerial(2012, 10, 1)
                Dim songayConlai As Integer = DateDiff(DateInterval.Day, Now, DateAdd(DateInterval.Day, i + 1, ngay))
                If songayConlai > 0 Then
                    If songayConlai <= 60 Then MsgBox("CÒN   " & songayConlai & "   NGÀY -> HẾT HẠN SỬ DỤNG", "THÔNG BÁO")
                ElseIf songayConlai <= 0 Then
                    MsgBox("HẾT HẠN SỬ DỤNG " & Chr(13) & Chr(13) & " YÊU CẦU CẬP NHẬT PHIÊN BẢN PHẦN MỀM!", MsgBoxStyle.Exclamation, "THÔNG BÁO")
                    Me.Close()
                End If
                Try
                    BusQuyenchitiet = New QuyenchitietBus(ketnoi)
                    Dim bangQuyenCt As New DataTable
                    Try
                        '??????????????????????????????? Me.Name
                        bangQuyenCt = BusQuyenchitiet.LayBangTableTheoQuyen(dtonguoidung.IdQuyen, Me.Name)
                    Catch ex As Exception
                    End Try
                    For j As Integer = 0 To bangQuyenCt.Rows.Count - 1
                        kiemtrabut(bangQuyenCt.Rows(j)("TenButon"))
                    Next
                    DICHTIENGANH()
                Catch ex As Exception
                End Try
            End If
            If BusQuyenchitiet.LayBangTableTheoQuyen(0).Rows.Count <= 0 Then
                DocFile("d:/dich2.txt", ketnoi)
            End If
        Catch ex As Exception
        End Try
    End Sub
#End Region
#Region "Csdl"
    'trỏ dử liệu
    Private Sub ButtonItem2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem2.Click
        Try
            ManhinhCauHinh.ShowDialog()
            MsgBox("Đề nghị tắt Phần mềm nếu có  lổi ", MsgBoxStyle.Exclamation, "Cảnh báo")
        Catch ex As Exception
        End Try
    End Sub
#End Region

#Region "NGUOI DUNG"
    'DANG KY
    Private Sub ButtonItem47_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem47.Click
        Try
            ManHinhDangKy.ShowDialog()
        Catch ex As Exception
        End Try
    End Sub
    'Phan quyen 
    Private Sub ButtonItem42_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem42.Click
        Try
            DockingForm(PhanQuyenChoNguoiDung_2_, DockContainer1)
        Catch ex As Exception
        End Try
    End Sub
    'DANH SACH NHAN VIEN
    Private Sub ButtonItem59_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem59.Click
        Try
            DockingForm(ManHinhXemNguoidung, DockContainer1)
        Catch ex As Exception
        End Try
    End Sub

#Region "Thông tin ca nhan"
    'xem thong tin ca nhan
    'Private Sub ButtonItem58_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem58.Click
    '    Try
    '        ManHinhThongTinNguoidung.ShowDialog()
    '    Catch ex As Exception
    '    End Try
    'End Sub
    'Sua mat khau
    Private Sub ButtonItem56_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem56.Click
        Try
            ManHinhSuaMatKhau.ShowDialog()
        Catch ex As Exception
        End Try
    End Sub
    Private Sub ButtonItem37_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem37.Click
        Try
            SplashScreen1.Show()
        Catch ex As Exception
        End Try
    End Sub

#End Region


#End Region
   
#End Region
    
    Private Sub ButtonItem17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonItem17.Click
      
    End Sub
End Class
